import copy


def full_arrange(n):
    data = []  # 中间结果
    res = []  # 最终结果
    if n == 1:
        return 1
    res = [[1]]
    for i in range(2, n + 1):
        for j in range(len(res)):  # 遍历res数组（二维数组）
            for x in range(len(res[j]) + 1):  # 遍历res数组中的元素（一维数组）
                data = copy.copy(res[j])  # 浅拷贝
                data.insert(x, i)  # 在一维数组的不同位置插入元素，获得新的数组
                res.append(data)
                x += 1
            j += 1
        # 删除多余数组（原始数组） 最后保留的数据(一维数组的长度) == i
        while True:
            if len(res[0]) != i:
                res.remove(res[0])
            else:
                break
        i += 1
    return res


def merge_sort(s, l, r):
    if l >= r: return 0
    mid = l + r >> 1
    res = merge_sort(s, l, mid) + merge_sort(s, mid + 1, r)
    i = l
    j = mid + 1
    tmp = []
    while (i <= mid and j <= r):
        if (s[i] <= s[j]):
            tmp.append(s[i])
            i += 1
        else:
            res += (mid - i + 1)
            tmp.append(s[j])
            j += 1
            pass
        pass
    while (i <= mid):
        tmp.append(s[i])
        i += 1
        pass
    while (j <= r):
        tmp.append(s[j])
        j += 1
        pass
    s[l:r + 1] = tmp
    return res


inputNum = list(map(int, input().split()))
length = inputNum[0]
inverseNum = inputNum[1]

inverseArr = full_arrange(length)
result = 0
for i in range(len(inverseArr)):
    if inverseNum == merge_sort(inverseArr[i], 0, len(inverseArr[i]) - 1):
        result += 1

print(result)
